From: kaf24@firebug.cl.cam.ac.uk Date: Thu, 13 Apr 2006 09:59:08 +0000 (+0100) Subject: This fixes the state machine of the vTPM driver. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~16158^2~2^2~33 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/success//%22http:/www.example.com/cgi/success/?a=commitdiff_plain;h=42f8fcaf1b6db14c903b1b9241c6a147961becca;p=xen.git This fixes the state machine of the vTPM driver. Signed-off-by: Stefan Berger --- diff --git a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c index 6e118e7b24..422abd0551 100644 --- a/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c +++ b/linux-2.6-xen-sparse/drivers/xen/tpmback/xenbus.c @@ -164,10 +164,10 @@ static void frontend_changed(struct xenbus_device *dev, switch (frontend_state) { case XenbusStateInitialising: - case XenbusStateConnected: + case XenbusStateInitialised: break; - case XenbusStateInitialised: + case XenbusStateConnected: err = connect_ring(be); if (err) { return; diff --git a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c index 53ccf66b82..d8d026b7a2 100644 --- a/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c +++ b/linux-2.6-xen-sparse/drivers/xen/tpmfront/tpmfront.c @@ -334,12 +334,6 @@ again: goto abort_transaction; } - err = xenbus_printf(xbt, dev->nodename, - "state", "%d", XenbusStateInitialised); - if (err) { - goto abort_transaction; - } - err = xenbus_transaction_end(xbt, 0); if (err == -EAGAIN) goto again; @@ -347,6 +341,9 @@ again: xenbus_dev_fatal(dev, err, "completing transaction"); goto destroy_tpmring; } + + xenbus_switch_state(dev, XenbusStateConnected); + return 0; abort_transaction: @@ -387,6 +384,7 @@ static void backend_changed(struct xenbus_device *dev, if (tp->is_suspended == 0) { device_unregister(&dev->dev); } + xenbus_switch_state(dev, XenbusStateClosed); break; } } @@ -439,6 +437,7 @@ static int tpmfront_suspend(struct xenbus_device *dev) /* lock, so no app can send */ mutex_lock(&suspend_lock); + xenbus_switch_state(dev, XenbusStateClosed); tp->is_suspended = 1; for (ctr = 0; atomic_read(&tp->tx_busy) && ctr <= 25; ctr++) {